package org.fujay.langchain4jserver.domain.conversation.exception;

import org.fujay.langchain4jserver.domain.conversation.vo.ConversationId;

/**
 * 当尝试访问或操作不存在的对话时抛出此异常。
 */
public class ConversationNotFoundException extends RuntimeException {

    private static final String MESSAGE_TEMPLATE = "未找到 ID 为 [%s] 的对话。";

    public ConversationNotFoundException(ConversationId conversationId) {
        super(
                String.format(
                        MESSAGE_TEMPLATE, conversationId != null ? conversationId.value() : "<null>"));
    }

    public ConversationNotFoundException(ConversationId conversationId, Throwable cause) {
        super(
                String.format(MESSAGE_TEMPLATE, conversationId != null ? conversationId.value() : "<null>"),
                cause);
    }
}
